import React, { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { clearUserInfo, fetchUserInfo } from '@/store/modules/user'


function useFetchUserInfo() {
    //触发用户个人信息 action
    const dispatch = useDispatch()

    useEffect(() => {
        dispatch(fetchUserInfo())
    }, [dispatch])
    const { mobile, username } = useSelector(state => state.user.userInfo)

    return { mobile, username}
}



export default useFetchUserInfo